package Java攻略._3_流式操作._4_利用reduce方法校验排序;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

public class _30_根据长度对字符串排序 {

    public static void main(String[] args) {

        List<String> stringList = Arrays.asList("this", "is", "a", "list", "of", "strings");

        List<String> strings = stringList.stream()
                .sorted(Comparator.comparingInt(String::length))
                .collect(Collectors.toList());

        System.out.println(strings);
    }
}
